package com.towker.frame.controller.sys;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.towker.core.util.BeanUtils;
import com.towker.web.MyRequest;


@Controller
public class ShareController {
	/**
	 * 验证class是否存在
	 * @param request
	 * @param response
	 * @throws IOException 
	 */
	@RequestMapping(value = "/share/validClass")
	public void validClass(HttpServletRequest request, HttpServletResponse response) throws IOException  
	{
		PrintWriter out=response.getWriter();
		try
		{
			MyRequest req=new MyRequest(request);
			 
			String className=req.getString("className");
			boolean isValid=BeanUtils.validClass(className);
			if(isValid)
				out.print("1");
			else
				out.print("0");
		}
		catch(Exception ex)
		{
			out.print("-1");
		}
		
		
	}
}
